{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using TensorFlow backend.\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import json\n",
    "from keras.models import Model\n",
    "from keras.layers import Input\n",
    "from keras.layers.convolutional import Conv2D\n",
    "from keras.layers.pooling import MaxPooling2D, AveragePooling2D\n",
    "from keras.layers.normalization import BatchNormalization\n",
    "from keras import backend as K\n",
    "from collections import OrderedDict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def format_decimal(arr, places=6):\n",
    "    return [round(x * 10**places) / 10**places for x in arr]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "DATA = OrderedDict()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### pipeline 10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "random_seed = 1010\n",
    "data_in_shape = (24, 24, 2)\n",
    "\n",
    "layers = [\n",
    "    Conv2D(5, (3,3), activation='relu', padding='valid', strides=(2,2), data_format='channels_last', use_bias=True),\n",
    "    BatchNormalization(epsilon=1e-03, axis=-1, center=True, scale=True),\n",
    "    Conv2D(4, (3,3), activation='relu', padding='same', strides=(1,1), data_format='channels_last', use_bias=True),\n",
    "    BatchNormalization(epsilon=1e-03, axis=-1, center=True, scale=True),\n",
    "    Conv2D(3, (3,3), activation='relu', padding='same', strides=(1,1), data_format='channels_last', use_bias=True),\n",
    "    BatchNormalization(epsilon=1e-03, axis=-1, center=True, scale=True),\n",
    "    AveragePooling2D(pool_size=(2,2), strides=None, padding='valid', data_format='channels_last'),\n",
    "    Conv2D(4, (3,3), activation='linear', padding='valid', strides=(1,1), data_format='channels_last', use_bias=True),\n",
    "    BatchNormalization(epsilon=1e-03, axis=-1, center=True, scale=True),\n",
    "    Conv2D(2, (3,3), activation='relu', padding='same', strides=(1,1), data_format='channels_last', use_bias=True),\n",
    "    BatchNormalization(epsilon=1e-03, axis=-1, center=True, scale=True),\n",
    "    AveragePooling2D(pool_size=(2,2), strides=None, padding='valid', data_format='channels_last')\n",
    "]\n",
    "\n",
    "input_layer = Input(shape=data_in_shape)\n",
    "x = layers[0](input_layer)\n",
    "for layer in layers[1:-1]:\n",
    "    x = layer(x)\n",
    "output_layer = layers[-1](x)\n",
    "model = Model(inputs=input_layer, outputs=output_layer)\n",
    "\n",
    "np.random.seed(random_seed)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "weights = []\n",
    "for i, w in enumerate(model.get_weights()):\n",
    "    np.random.seed(random_seed + i)\n",
    "    if i % 6 == 5:\n",
    "        # std should be positive\n",
    "        weights.append(0.5 * np.random.random(w.shape))\n",
    "    else:\n",
    "        weights.append(np.random.random(w.shape) - 0.5)\n",
    "model.set_weights(weights)\n",
    "\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "\n",
    "DATA['pipeline_10'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in weights],\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### export for Keras.js tests"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import os\n",
    "\n",
    "filename = '../../test/data/pipeline/10.json'\n",
    "if not os.path.exists(os.path.dirname(filename)):\n",
    "    os.makedirs(os.path.dirname(filename))\n",
    "with open(filename, 'w') as f:\n",
    "    json.dump(DATA, f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\"pipeline_10\": {\"input\": {\"data\": [-0.211487, -0.648815, -0.854588, -0.616238, -0.200391, -0.163753, 0.525164, 0.04282, -0.178234, 0.074889, -0.458875, -0.133347, 0.654533, -0.456294, 0.454776, -0.799519, -0.004428, 0.160632, 0.153349, -0.585922, -0.407693, 0.794725, -0.535387, 0.408942, -0.182012, 0.741361, 0.045939, -0.156736, -0.156846, -0.357358, 0.539258, 0.948017, -0.307682, -0.715505, 0.740323, 0.616044, -0.79421, 0.478351, -0.40107, 0.597915, -0.251741, -0.56835, -0.30559, 0.943538, -0.121007, -0.5726, 0.63163, -0.4633, -0.466873, -0.269675, 0.939682, -0.088032, -0.686666, -0.763883, 0.327973, -0.116397, -0.369221, 0.023515, 0.355153, 0.071139, -0.748422, -0.178133, -0.416396, -0.96893, -0.992102, 0.872025, -0.453677, -0.696693, -0.847087, 0.968047, 0.350708, 0.123802, -0.658602, -0.017016, 0.567433, 0.69692, -0.125943, -0.93719, -0.331865, -0.819113, -0.307996, 0.12548, 0.781431, -0.837784, 0.606706, 0.184851, 0.896077, -0.706952, -0.444589, 0.806915, 0.575949, -0.599633, 0.588646, 0.162818, -0.951798, 0.227047, 0.153506, -0.817576, -0.671, -0.849184, -0.748259, 0.650901, 0.286647, -0.577941, -0.254328, -0.412536, -0.566946, -0.983986, -0.293822, -0.807716, 0.396576, -0.017533, 0.374002, -0.940263, -0.28683, -0.032966, 0.704066, -0.668463, -0.867457, 0.563842, 0.711939, 0.36657, 0.439858, -0.256388, 0.700991, 0.353122, 0.627541, -0.018557, -0.550522, 0.034842, -0.861297, 0.697198, -0.717249, -0.338883, 0.574879, 0.201778, -0.773585, -0.907219, -0.541137, -0.983263, -0.073794, -0.063249, -0.304643, -0.542468, -0.024876, 0.957046, -0.890287, -0.95423, -0.35859, 0.707582, -0.414525, 0.98281, -0.840991, 0.670857, -0.517095, -0.97728, -0.596145, -0.187667, 0.176146, 0.660078, 0.618448, 0.788673, 0.23957, 0.442463, 0.957621, 0.464035, -0.073558, -0.943771, 0.253811, 0.239941, -0.077503, -0.432583, 0.741449, -0.030325, 0.107173, -0.335553, -0.338802, -0.238757, -0.177719, 0.86934, 0.29915, 0.767597, 0.337219, -0.81214, 0.322001, -0.066413, 0.393974, -0.630747, -0.126817, -0.447364, 0.433005, 0.630328, 0.134321, 0.218126, 0.467566, 0.994284, 0.936974, -0.16345, -0.054392, 0.578973, 0.02789, 0.607078, -0.905162, 0.817212, 0.571797, 0.746717, -0.858798, -0.677018, 0.061415, -0.359554, 0.306731, -0.676207, -0.479553, -0.075125, -0.296608, 0.0846, -0.47186, 0.951183, -0.842198, 0.192606, 0.984438, 0.745911, -0.446504, -0.087888, 0.475639, 0.489532, -0.340481, -0.074796, 0.371134, -0.857507, 0.279958, -0.240501, 0.02041, -0.873113, -0.090778, 0.255301, 0.367262, -0.755676, -0.166799, -0.484583, 0.713342, -0.81598, -0.232422, -0.239891, 0.461332, 0.265431, -0.573575, -0.083217, -0.845652, -0.3866, -0.96085, 0.192581, 0.126412, -0.555882, 0.916411, 0.537562, -0.725692, 0.1736, 0.873457, 0.253362, 0.042509, -0.217085, 0.986334, 0.433252, -0.33923, -0.615949, 0.301147, -0.785499, -0.559479, -0.532074, 0.141371, 0.545126, 0.034906, -0.335253, -0.453893, 0.497492, 0.898748, -0.39389, 0.838399, -0.236518, 0.144143, 0.885685, 0.325633, 0.421394, -0.344087, -0.923068, -0.14082, -0.600177, -0.011477, 0.826936, 0.018516, 0.928581, 0.279901, -0.101336, 0.838887, -0.121768, -0.249745, 0.586803, -0.423534, 0.696569, 0.316766, 0.654712, 0.057621, 0.176145, 0.644504, 0.161908, 0.113353, 0.242041, 0.62892, 0.833678, -0.130733, 0.988066, 0.553103, -0.337291, 0.117769, -0.686175, -0.445918, 0.260141, 0.766071, 0.949129, -0.727603, -0.960786, -0.769989, -0.026494, 0.485937, 0.568217, -0.653145, 0.57998, -0.874358, 0.556881, 0.464593, -0.438544, 0.753502, -0.12171, -0.306957, -0.948638, -0.541523, -0.987951, 0.370394, -0.723811, -0.937695, -0.46059, -0.003645, 0.756004, 0.786475, 0.706709, 0.086473, 0.696161, -0.892919, 0.8686, 0.924258, -0.292324, 0.560407, 0.204728, 0.313226, 0.395606, 0.416301, 0.26041, -0.415121, 0.710899, -0.844378, 0.610586, 0.047505, 0.71082, 0.884238, -0.989573, -0.189233, 0.57696, -0.395056, 0.823768, -0.855135, -0.369814, -0.195757, -0.287205, 0.372043, -0.671961, -0.974754, -0.151095, 0.703488, 0.081641, -0.520269, -0.337677, -0.747943, -0.686257, -0.640246, 0.680416, 0.325591, 0.688032, -0.96195, 0.306175, -0.879886, 0.420185, 0.766079, -0.164168, 0.676036, -0.468121, -0.74505, 0.522572, 0.011735, 0.124346, -0.354235, 0.177338, -0.599265, -0.328387, -0.522008, 0.707613, 0.422392, 0.771837, -0.64196, 0.475628, 0.511435, -0.788991, -0.093638, -0.325932, -0.456862, 0.416982, -0.940774, 0.788928, 0.994588, -0.233629, 0.132131, 0.361126, 0.604648, 0.19138, -0.574623, 0.838043, 0.013884, 0.397381, -0.419173, -0.956041, -0.269547, 0.455662, -0.753089, 0.668025, -0.93109, -0.113329, -0.81614, 0.433672, -0.8422, -0.151172, -0.559628, -0.264853, 0.842841, -0.117746, 0.42709, 0.049047, 0.109697, -0.682604, 0.481446, 0.633866, -0.297759, -0.512007, -0.512688, -0.473249, -0.441775, -0.986424, 0.558126, -0.381198, 0.615984, 0.933633, -0.602776, 0.778283, -0.569336, 0.862145, 0.962879, -0.791595, 0.383601, -0.566894, -0.661305, 0.01165, -0.924102, 0.663944, -0.840395, 0.571528, -0.52181, 0.497824, 0.901409, 0.715014, 0.372864, 0.459924, 0.254445, -0.097057, 0.616305, 0.383037, 0.379252, -0.974434, 0.000725, 0.252363, -0.987052, -0.526238, 0.06431, -0.782735, -0.891275, 0.131536, 0.142232, 0.321723, 0.564042, 0.612093, 0.968308, -0.677833, 0.723292, 0.196553, -0.328137, -0.100943, -0.642894, 0.478763, 0.989806, -0.763239, -0.561432, 0.234037, -0.198122, -0.433915, -0.307004, 0.488096, -0.742153, 0.933829, -0.649367, -0.96112, -0.609903, -0.942094, 0.700194, -0.120584, -0.806965, -0.687978, 0.27271, 0.096444, 0.233286, -0.428687, -0.740385, -0.719975, -0.872181, 0.566417, -0.654516, -0.643392, -0.216667, -0.151509, -0.723338, 0.145573, 0.445633, 0.06802, 0.236349, 0.995729, 0.844226, 0.130481, 0.45828, -0.399518, 0.904658, 0.882354, -0.814835, 0.585192, 0.180694, 0.29275, 0.218828, -0.769477, 0.731303, 0.575253, -0.655148, 0.594264, 0.939411, -0.956515, 0.828551, 0.753208, 0.962677, 0.17711, 0.332353, -0.050181, -0.183284, -0.804351, 0.471536, -0.848871, 0.692837, 0.873866, -0.349549, -0.034261, 0.868022, 0.296839, -0.204561, -0.569548, -0.51495, -0.500745, -0.850157, 0.173336, -0.989929, -0.072061, 0.932058, 0.801528, -0.280265, -0.70447, -0.29975, 0.75959, -0.484978, 0.643054, 0.047118, 0.349217, -0.395347, 0.814199, -0.817948, -0.693368, 0.917537, -0.302319, -0.287128, -0.948706, -0.549166, -0.245432, 0.753077, 0.359849, 0.688879, 0.173455, -0.955522, -0.238255, -0.989083, -0.932594, -0.927659, 0.284148, -0.644712, 0.523025, -0.181609, -0.390084, 0.337744, -0.069207, -0.330216, 0.16528, 0.450313, 0.209265, 0.294635, -0.676182, 0.347176, 0.69657, 0.113864, 0.089357, -0.054454, -0.18564, -0.393973, 0.328501, -0.97018, 0.141014, -0.378661, 0.743955, -0.759748, 0.900098, -0.269771, 0.079827, -0.821901, 0.439771, -0.622663, -0.16033, 0.960884, -0.819765, 0.386759, 0.39802, -0.289726, 0.020553, 0.645491, -0.542014, -0.056736, -0.999825, -0.134639, -0.509276, 0.216579, 0.431744, 0.268377, -0.496743, 0.244172, -0.228141, 0.686326, -0.091255, -0.575963, 0.661089, 0.405163, -0.898359, 0.728178, -0.041462, 0.603477, -0.683898, -0.223244, -0.764741, 0.521807, 0.844612, -0.478939, 0.18983, 0.403557, -0.021909, -0.463063, 0.307107, -0.469741, 0.601333, -0.424259, -0.106491, -0.347494, -0.684164, 0.824376, -0.73703, -0.134965, 0.228432, -0.805504, 0.8044, 0.565375, -0.498041, 0.402136, -0.79768, 0.442393, 0.831563, -0.453947, 0.235096, 0.738341, 0.715044, 0.191103, 0.303483, -0.244363, -0.556684, -0.556518, -0.663403, 0.493214, 0.212958, -0.965177, 0.15536, -0.691567, -0.332828, -0.606472, 0.933398, -0.290933, 0.640888, 0.670573, 0.745127, -0.816076, 0.227025, -0.681638, 0.372676, 0.650288, -0.424077, -0.11915, 0.607186, 0.147117, -0.547458, 0.828968, 0.651498, -0.682715, 0.485317, 0.842274, 0.678841, 0.806453, -0.36126, -0.490016, 0.127711, -0.793232, 0.151169, 0.733939, -0.707677, 0.636842, 0.892719, 0.27572, 0.196575, -0.132092, -0.984314, 0.225733, -0.137189, -0.001739, 0.120528, -0.528929, 0.073165, -0.2013, -0.359488, -0.428151, -0.145162, -0.885605, -0.65101, -0.891164, 0.576165, -0.289676, 0.532909, -0.228881, 0.258747, 0.615797, 0.116209, -0.822129, 0.950565, -0.978995, 0.950228, -0.78094, -0.421078, 0.259049, 0.600187, -0.63732, -0.743414, 0.751681, -0.712414, 0.925834, 0.939001, -0.686472, 0.619574, -0.12938, -0.627952, -0.938295, -0.318988, 0.474828, 0.332817, -0.90961, -0.52716, -0.740149, 0.063218, -0.843116, 0.041718, 0.288534, 0.49974, 0.010233, 0.256757, 0.799532, -0.759611, 0.172536, 0.569741, -0.507621, 0.431463, -0.788891, 0.869081, 0.506492, 0.193677, 0.045459, -0.434452, -0.302548, 0.894244, 0.893155, 0.525835, 0.694184, -0.120878, 0.709463, 0.84512, 0.436009, -0.08493, -0.809318, 0.30403, -0.506082, -0.061754, -0.766573, 0.96843, -0.441034, 0.465034, 0.066526, 0.979107, 0.258505, 0.614686, 0.807876, 0.571146, -0.139333, -0.575773, 0.059001, 0.065995, -0.442485, 0.770726, -0.56145, -0.002581, 0.123632, 0.286272, 0.736907, -0.425765, 0.643719, 0.442091, 0.564978, 0.975132, -0.959181, -0.346908, 0.361415, 0.45659, -0.965579, 0.148424, 0.971231, 0.360346, -0.14688, -0.669599, 0.210036, 0.213113, -0.951116, 0.008142, 0.16823, 0.556843, 0.17473, 0.714578, -0.393667, 0.635171, 0.28558, -0.626201, -0.935807, 0.827338, 0.107585, -0.666511, -0.504853, 0.190522, -0.126819, 0.413916, -0.616406, 0.647926, -0.111193, 0.837551, 0.357342, 0.175992, -0.716909, -0.081522, -0.501716, -0.078776, -0.563542, 0.498419, -0.268797, 0.987523, -0.422554, -0.239177, 0.88758, 0.388794, 0.655419, -0.55882, -0.554116, 0.729043, 0.364481, -0.477312, -0.719177, 0.122892, 0.309716, 0.840029, 0.665197, -0.328095, -0.70813, 0.123461, 0.3482, -0.621451, 0.152003, 0.500855, -0.897611, 0.848806, -0.95738, 0.379625, -0.52258, 0.610251, -0.744892, -0.313679, -0.108129, -0.757706, 0.99596, 0.134514, 0.453975, 0.371479, 0.916976, -0.771224, 0.405723, -0.137096, -0.301547, 0.859121, 0.79225, -0.220752, 0.536488, 0.268725, -0.236298, 0.572088, -0.102714, -0.597464, -0.784908, -0.165337, 0.12104, 0.709681, 0.249255, 0.278907, 0.07497, -0.550291, -0.22309, 0.032838, 0.375763, 0.645641, -0.384167, -0.759189, -0.847081, 0.779763, -0.443268, 0.037199, -0.788967, 0.21665, -0.611079, -0.046826, 0.579769, 0.119662, 0.709796, -0.999028, -0.409652, -0.025137, -0.751542, 0.613724, 0.509866, 0.09583, -0.721087, 0.20721, 0.362112, 0.461434, 0.819706, 0.41558, -0.710221, 0.893349, -0.415489, 0.029208, -0.024596, -0.947785, 0.67363, -0.628179, 0.100113, 0.638908, 0.78795, -0.702054, -0.475651, -0.740976, -0.344164, -0.778689, -0.386363, -0.403109, -0.633264, -0.494866, 0.511494, 0.172772, -0.629628, 0.238123, -0.446291, -0.289251, -0.830798, 0.560617, 0.150829, -0.529908, -0.574996, -0.310313, 0.642678, -0.808008, 0.247471, 0.729568, 0.590706, 0.716683, 0.270212, 0.966135, -0.141421, -0.620286, 0.182783, 0.154163, 0.919872, 0.942017, -0.24159, 0.782047, 0.833566, -0.322271, -0.491568, -0.305147, 0.249005, -0.568363, -0.332018, 0.511612, 0.206232, -0.126419, -0.94354, 0.766775, -0.212371, 0.719048, 0.275296, 0.932821, 0.158063, -0.776963, 0.894601, 0.127313, -0.895394, -0.859557, 0.172843, -0.713406, -0.517638, -0.827664, 0.096541, -0.872854, 0.321896, 0.886612, 0.275402, 0.285683, -0.103728, -0.427364, 0.58859, -0.353534, -0.663081, -0.052204, 0.599905, 0.419979, -0.017918, 0.554695, 0.293886, -0.306972, -0.303632, 0.470732, -0.810239, 0.521691, -0.210834, 0.787344, -0.285175, 0.954496, -0.441988, 0.495433, 0.695281, -0.515097, 0.152165, -0.656975, -0.685529, 0.842046, -0.468261, 0.412769, 0.174158, 0.954061, 0.115667, -0.434228, -0.062904, 0.627315, -0.016548, -0.812432, 0.917903, 0.164779, -0.301063, -0.789996, -0.120868, 0.902108, -0.504864, -0.405826, -0.502219, -0.888746, 0.822723, 0.141955, 0.555938, 0.860172, 0.111075, -0.876811, 0.03627, -0.501811, 0.178016, 0.944558, -0.866721, 0.165101, -0.615916, -0.20888, -0.134146, -0.438544, -0.25977, -0.990068, 0.847897, -0.234133, 0.856832, 0.928978, 0.817289, 0.676519, 0.246363, -0.534418, 0.374409, -0.111751, -0.751971, 0.638209, -0.683111, -0.574236, -0.857826, -0.921484], \"shape\": [24, 24, 2]}, \"weights\": [{\"data\": [-0.105744, -0.324408, -0.427294, -0.308119, -0.100196, -0.081877, 0.262582, 0.02141, -0.089117, 0.037444, -0.229438, -0.066673, 0.327266, -0.228147, 0.227388, -0.39976, -0.002214, 0.080316, 0.076675, -0.292961, -0.203847, 0.397363, -0.267693, 0.204471, -0.091006, 0.370681, 0.022969, -0.078368, -0.078423, -0.178679, 0.269629, 0.474009, -0.153841, -0.357752, 0.370162, 0.308022, -0.397105, 0.239175, -0.200535, 0.298957, -0.125871, -0.284175, -0.152795, 0.471769, -0.060504, -0.2863, 0.315815, -0.23165, -0.233437, -0.134838, 0.469841, -0.044016, -0.343333, -0.381942, 0.163987, -0.058199, -0.184611, 0.011758, 0.177577, 0.035569, -0.374211, -0.089067, -0.208198, -0.484465, -0.496051, 0.436013, -0.226839, -0.348347, -0.423544, 0.484023, 0.175354, 0.061901, -0.329301, -0.008508, 0.283717, 0.34846, -0.062972, -0.468595, -0.165932, -0.409557, -0.153998, 0.06274, 0.390716, -0.418892, 0.303353, 0.092426, 0.448039, -0.353476, -0.222294, 0.403458], \"shape\": [3, 3, 2, 5]}, {\"data\": [0.155681, -0.114259, 0.126512, -0.387817, 0.308028], \"shape\": [5]}, {\"data\": [-0.473271, 0.292796, -0.247635, 0.297266, -0.192785], \"shape\": [5]}, {\"data\": [0.057039, -0.444829, -0.236013, 0.359404, -0.079814], \"shape\": [5]}, {\"data\": [-0.268201, 0.202212, -0.169172, -0.409066, 0.220783], \"shape\": [5]}, {\"data\": [0.313756, 0.069688, 0.308834, 0.324175, 0.410051], \"shape\": [5]}, {\"data\": [0.338636, 0.20719, 0.282811, 0.179391, 0.200739, -0.167615, 0.26106, 0.411037, -0.107794, 0.248191, -0.254319, 0.298721, -0.190157, 0.187746, -0.245647, 0.171369, -0.33573, -0.172835, -0.186083, -0.478868, -0.23328, 0.211791, -0.159011, -0.015877, 0.278096, 0.199024, 0.300763, 0.267202, -0.149906, -0.12972, 0.349286, 0.273694, 0.279177, -0.496627, 0.13382, 0.156434, -0.442754, 0.099495, 0.126045, 0.355768, 0.303938, 0.3549, -0.089305, -0.266387, 0.061607, -0.356033, -0.183023, 0.031131, -0.118214, -0.391987, 0.412371, -0.202207, -0.481942, -0.08039, -0.18153, -0.490883, 0.290027, -0.087688, -0.237534, 0.158277, 0.020915, 0.316662, 0.411252, 0.425062, 0.29171, 0.429007, -0.147552, 0.177068, 0.027529, -0.215451, 0.095034, -0.038251, -0.418378, -0.342015, 0.012428, 0.108674, -0.196149, -0.436378, -0.292705, -0.220138, -0.084259, 0.356288, -0.368477, -0.296691, 0.271579, 0.311433, -0.333948, 0.060278, 0.009043, -0.108377, -0.286809, 0.312583, -0.315059, 0.169298, -0.380516, -0.199556, -0.218836, 0.3816, -0.427367, -0.105854, -0.281138, 0.143875, 0.374664, 0.38553, 0.344604, -0.072909, 0.238421, 0.371408, -0.456384, 0.468531, -0.298943, -0.222945, -0.319171, -0.025892, 0.497537, 0.080948, 0.061027, 0.272792, 0.297042, 0.010371, 0.066541, 0.050594, -0.496317, 0.267114, -0.098434, -0.134848, -0.499887, 0.337468, -0.18555, 0.293125, 0.412891, -0.101229, -0.094691, -0.202321, -0.008947, -0.017387, -0.336376, 0.397735, 0.026379, -0.409799, -0.441084, 0.461488, -0.089454, -0.01924, 0.250129, 0.40555, 0.089279, -0.402324, 0.157605, -0.371383, -0.385904, 0.239558, 0.108085, 0.413144, 0.481998, 0.221921, -0.135757, 0.162223, 0.23519, 0.351702, -0.462569, 0.173067, 0.471246, 0.241819, -0.076074, 0.463076, -0.368766, -0.417256, -0.41546, 0.348056, 0.278639, -0.187144, -0.278233, -0.395189, 0.414657, -0.376775, -0.132993, 0.275654, 0.0601, 0.000767], \"shape\": [3, 3, 5, 4]}, {\"data\": [-0.387465, 0.420455, -0.026985, 0.159057], \"shape\": [4]}, {\"data\": [-0.419033, 0.444903, 0.251663, -0.020549], \"shape\": [4]}, {\"data\": [-0.176081, -0.382328, -0.494196, 0.361299], \"shape\": [4]}, {\"data\": [0.258953, -0.333269, 0.189332, -0.190031], \"shape\": [4]}, {\"data\": [0.350139, 0.435968, 0.359283, 0.1113], \"shape\": [4]}, {\"data\": [-0.363197, 0.480702, -0.176325, -0.308416, -0.478993, 0.369125, -0.114721, -0.150834, -0.200724, -0.088494, 0.017655, -0.124137, 0.365617, -0.375998, -0.26012, 0.070867, 0.095436, 0.211752, 0.258729, 0.238646, -0.322748, -0.178448, -0.399007, -0.136994, -0.030154, 0.361352, 0.029824, -0.411331, -0.072522, 0.467142, -0.191307, -0.17342, -0.373035, -0.20742, 0.14345, 0.17255, 0.135371, 0.4872, 0.186298, 0.129056, 0.182046, -0.333262, -0.341536, 0.186163, 0.418206, -0.110295, -0.052309, 0.079381, -0.15157, -0.391252, -0.428706, 0.010955, -0.282799, 0.340062, 0.097728, -0.315729, -0.411973, 0.242034, 0.07638, 0.297559, -0.168876, 0.284677, 0.072629, -0.342871, 0.210131, -0.438498, -0.048469, -0.334407, -0.169922, -0.016507, -0.207149, 0.45181, -0.320194, 0.025634, 0.183396, 0.495365, 0.267573, 0.277503, 0.207013, 0.3236, -0.255794, -0.42529, -0.176822, 0.146355, 0.372037, -0.367906, 0.344921, 0.309675, 0.498498, -0.294221, 0.499831, 0.157709, -0.359573, 0.202213, 0.024765, -0.310477, -0.249998, -0.223214, -0.350651, 0.012537, 0.166807, -0.202914, 0.375927, -0.118506, -0.130296, 0.428721, -0.328967, -0.422645], \"shape\": [3, 3, 4, 3]}, {\"data\": [0.41407, 0.130071, 0.008933], \"shape\": [3]}, {\"data\": [0.147691, 0.496914, 0.018803], \"shape\": [3]}, {\"data\": [0.102249, 0.115466, -0.161441], \"shape\": [3]}, {\"data\": [-0.148353, 0.340733, 0.455803], \"shape\": [3]}, {\"data\": [0.054752, 0.301243, 0.464977], \"shape\": [3]}, {\"data\": [0.220722, -0.380421, -0.117344, 0.104359, -0.497031, -0.07543, -0.148537, -0.269826, -0.05609, 0.253409, 0.478457, -0.27103, -0.038678, -0.240483, 0.31963, -0.081088, -0.337962, -0.219119, 0.436797, 0.470316, -0.122672, 0.321844, -0.199556, -0.075864, 0.06309, 0.37989, 0.059943, 0.33292, 0.157291, -0.430177, -0.075621, -0.274745, 0.02282, 0.313773, 0.443322, -0.477362, 0.242266, -0.417622, 0.48927, 0.064398, -0.444449, 0.432476, -0.391311, 0.305783, 0.22061, -0.226778, -0.024047, -0.106721, -0.097658, 0.303011, -0.432297, -0.047801, -0.473738, 0.170267, -0.044109, -0.110921, 0.006417, -0.12821, -0.450658, -0.356479, -0.087018, -0.324549, -0.498995, 0.467814, -0.189086, -0.039171, -0.424481, -0.05799, -0.498698, -0.375957, -0.347348, -0.237406, -0.415603, -0.157592, -0.456677, 0.241167, 0.478924, -0.134346, 0.203159, -0.055508, -0.16574, -0.147594, -0.133379, 0.190899, -0.279378, -0.237164, 0.342441, 0.139178, -0.143426, 0.275647, -0.196279, -0.014323, 0.460813, 0.152747, 0.151232, 0.143627, 0.229982, 0.325932, 0.246786, 0.209228, -0.461555, -0.135459, -0.392947, 0.280361, 0.46313, 0.140246, 0.485094, 0.429612], \"shape\": [3, 3, 3, 4]}, {\"data\": [-0.45896, -0.09023, 0.088714, 0.399933], \"shape\": [4]}, {\"data\": [-0.044936, -0.105153, -0.277222, 0.116398], \"shape\": [4]}, {\"data\": [-0.498982, -0.243671, -0.175181, -0.08177], \"shape\": [4]}, {\"data\": [-0.072718, 0.05936, -0.184282, 0.110561], \"shape\": [4]}, {\"data\": [0.243466, 0.293677, 0.25852, 0.29431], \"shape\": [4]}, {\"data\": [0.30588, -0.045016, 0.201302, -0.247522, -0.310648, 0.374592, 0.310119, -0.49852, -0.251373, 0.342033, -0.457418, -0.288983, 0.038628, 0.492305, 0.181373, 0.315071, 0.191088, -0.319951, 0.354536, 0.082963, -0.422923, 0.379718, -0.222928, 0.44584, -0.16651, -0.217136, 0.333607, 0.197894, -0.033804, -0.360066, -0.304421, -0.124216, -0.008938, 0.058388, -0.480625, 0.438791, 0.379387, -0.331152, -0.36293, -0.479966, -0.442867, -0.296998, -0.427627, -0.247115, -0.141304, 0.069741, -0.301579, 0.310119, -0.400299, 0.010905, -0.275538, 0.140048, -0.361019, -0.200752, 0.222361, -0.29928, 0.020972, -0.074235, 0.222939, -0.270126, 0.199916, -0.116975, -0.47668, 0.485774, -0.358835, 0.414706, -0.013512, -0.022784, -0.400217, 0.392565, 0.40759, -0.113654], \"shape\": [3, 3, 4, 2]}, {\"data\": [-0.48734, 0.244064], \"shape\": [2]}, {\"data\": [0.259769, -0.033387], \"shape\": [2]}, {\"data\": [0.096415, 0.24587], \"shape\": [2]}, {\"data\": [0.304433, 0.478386], \"shape\": [2]}, {\"data\": [0.22728, 0.392205], \"shape\": [2]}], \"expected\": {\"data\": [0.061192, 0.261301], \"shape\": [1, 1, 2]}}}\n"
     ]
    }
   ],
   "source": [
    "print(json.dumps(DATA))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
